*********************************************
*         Replication File For              *
*        The Political Economy:             *
* Political Attitudes and Economic Behavior *
*    Ellen M. Key & Kathleen M. Donovan     *
*********************************************
set more off
version 13.1

*Use PCE data.dta

***Generate the ECM
*This is already included in dataset and has been fractionally differenced in RATS
*reg pce_i ics rdi
*predict pce_ecm2, res

*This ECMs and other variables were fractionally differenced in RATS.
*The fractionally differenced versions are included in the Stata dataset.

***Table 1
arch pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect2 /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1, /// 
archm arch(1) ///
het(L(0/2).national1df L(0/2)d.honey L(0/2)d.elect2  /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow  L(0/2).rdi1df L(0/2).rawpos1df L(0/2).rawneg1df)

*diagnostics
dwstat
estat ic
predict res, res
predict v, variance
wntestq res, lags(20)

***Table 2: Granger Causality and Weak Exogeneity
*App GC PCE
reg pcei1df L(1/4).pcei1df L(1/4).national1df
testparm L(1/4).national1df
*ICS GC PCE
reg pcei1df L(1/4).pcei1df L(1/4).ics1df
testparm L(1/4).ics1df
*PCE GC Approval
reg national1df L(1/4).national1df L(1/4).pcei1df
testparm L(1/4).pcei1df
*PCE GC ICS
reg ics1df L(1/4).ics1df L(1/4).pcei1df
testparm L(1/4).pcei1df

***Weak exogeneity tests
*Is approval weakly exogeneous to PCE?
	*Get the ECM
reg  pce_i national
predict pce_ecm_we, res
	*See if ECM is significant
reg national1df c8 L(0/1).b1 w1 L(0/2).honey /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df ld.pce_ecm_we
	*Get residuals WITHOUT the ECM
reg national1df c8 L(0/1).b1 w1 L(0/2).honey /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df
predict appres, res
	*See if residuls are significant
reg pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1 appres
drop pce_ecm_we appres

*Is ICS weakly exogeneous to PCE?
	*Get the ECM
reg  pce_i ics rdi
predict pce_ecm_we, res
	*See if ECM is significant
reg ics1df interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2).honey /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df L(0/2).cpidf L(0/2).unempdf L(0/2).national1df /// 
ld.pce_ecm_we
	*Get residuals WITHOUT the ECM
reg ics1df interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2).honey /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df L(0/2).cpidf L(0/2).unempdf L(0/2).national1df
predict icsres, res
	*See if residuls are significant
reg pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1 icsres
drop pce_ecm_we icsres


*Is ICS weakly exogeneous to RDI?
	*Get the ECM
reg  rdi ics
predict pce_ecm_we, res
	*See if ECM is significant
reg ics1df interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2).honey /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df L(0/2).cpidf L(0/2).unempdf /// 
L(0/2).national1df Ld.pce_ecm_we
	*Get residuals WITHOUT the ECM
reg ics1df interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2).honey /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df L(0/2).cpidf L(0/2).unempdf /// 
L(0/2).national1df
predict icsres, res
	*See if residuls are significant
reg rdi1df recess SALT /// 
L(0/2).honey L(0/2).elect2 L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow icsres
drop pce_ecm_we icsres

*Is RDI weakly exogeneous to PCE?
	*Get the ECM
reg  pce_i rdi
predict pce_ecm_we, res
	*See if ECM is significant
reg rdi1df recess SALT /// 
L(0/2).honey L(0/2).elect2 L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow ld.pce_ecm_we
	*Get residuals WITHOUT the ECM
reg rdi1df recess SALT /// 
L(0/2).honey L(0/2).elect2 L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow
predict rdires, res
	*See if residuls are significant
reg pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1 rdires
drop pce_ecm_we rdires


***Get ECM to include in RDI equation
*This is already included in dataset and has been fractionally differenced in RATS 
*reg rdi ics pce_i
*predict rip_ecm, res

***Table 3: Specifications of the Mean of PCE
reg pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1

*Table 3: SUR
sureg (ics1df interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2).honey /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df L(0/2).cpidf /// 
L(0/2).unempdf L(0/2).national1df) /// 
(national1df c8 L(0/1).b1 w1 L(0/2).honey /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L(0/2).ecoterm4_freq1df) /// 
(rdi1df recess SALT /// 
L(0/2).honey L(0/2).elect2 L(0/2).cpidf L(0/2).unempdf L(0/2)d.dow /// 
L.ripecmdf) /// 
(pcei1df  /// 
L(0/2).national1df L(0/2)d.honey L(0/2)d.elect /// 
L(0/2).cpidf L(0/2).unempdf L(0/2).ics1df L(0/2)d.dow L(0/2).rdi1df /// 
L(0/2).rawpos1df L(0/2).rawneg1df L.pceecm2df  d.d2000 d.w1)

***Appendix D: Table 1 in First Differences
arch d.pce_i  /// 
L(0/2)d.national L(0/2)d.honey L(0/2)d.elect2 /// 
L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.ics L(0/2)d.dow L(0/2)d.rdi /// 
L(0/2)d.rawpos L(0/2)d.rawneg Ld.pce_ecm2  d.d2000 d.w1, /// 
archm arch(1) ///
het(L(0/2)d.national L(0/2)d.honey L(0/2)d.elect2 /// 
L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.ics L(0/2)d.dow  L(0/2)d.rdi L(0/2)d.rawpos L(0/2)d.rawneg)
dwstat

***Appendix E: Table 3 in First Differences
*Appendix E: FECM
reg d.pce_i  /// 
L(0/2)d.national L(0/2)d.honey L(0/2)d.elect2 /// 
L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.ics L(0/2)d.dow L(0/2)d.rdi /// 
L(0/2)d.rawpos L(0/2)d.rawneg Ld.pce_ecm2  d.d2000 d.w1

*Appendix E: SUR
sureg (d.ics interestdereg L(1).reaganelect iraqinvade bushstock clintelect L(1).sadam bailout L(0/2)d.honey /// 
L(0/2)d.rawpos L(0/2)d.rawneg L(0/2)d.ecoterm4_freq L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.national) /// 
(d.national c8 L(0/1).b1 w1 L(0/2)d.honey /// 
L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.ics /// 
L(0/2)d.rawpos L(0/2)d.rawneg L(0/2)d.ecoterm4_freq) ///
(rdi1df recess SALT /// 
L(0/2)d.honey L(0/2)d.elect2 L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.dow Ld.rip_ecm /// 
L.ripecmdf) ///  
(d.pce_i  /// 
L(0/2)d.national L(0/2)d.honey L(0/2)d.elect2 /// 
L(0/2)d.cpi L(0/2)d.unemp L(0/2)d.ics L(0/2)d.dow L(0/2)d.rdi /// 
L(0/2)d.rawpos L(0/2)d.rawneg Ld.pce_ecm2  d.d2000 d.w1)



